<?php if(!class_exists('raintpl')){exit;}?><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?>
<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("navigator") . ( substr("navigator",-1,1) != "/" ? "/" : "" ) . basename("navigator") );?>

<div id = "container">
	<div class = "sidebar-sar">
		<ul>
			<?php $counter1=-1; if( isset($page) && is_array($page) && sizeof($page) ) foreach( $page as $key1 => $value1 ){ $counter1++; ?>
			<li><a href="sar.php?id=<?php echo $value1["id"];?>"><?php echo $value1["page"];?></a></li>
			<?php } ?>
		</ul>
	</div>

	<div id = "sar" class = "center">
		<h1 class = "topic"><?php echo $page["$id"]['page'];?></h1>

		<?php if( $id==6 || $id==7 ){ ?>
		<a href = "staff-form.php?page=<?php echo $id;?>">เพิ่มรายชื่อ</a>
		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list">
			<tr>
				<td class = "w150">รูป</td>
				<td class = "w200">ชื่อ นามสกุล</td>
				<td class = "w150">ตำแหน่ง</td>
				<?php if( $user['level_name']=='officer' ){ ?>
					<td>เครื่องมือ</td>
				<?php } ?>
			</tr>
			<?php $counter1=-1; if( isset($staff) && is_array($staff) && sizeof($staff) ) foreach( $staff as $key1 => $value1 ){ $counter1++; ?>
			<tr>
				<td><img src = "<?php echo $value1["picture"];?>"></td>
				<td><?php echo $value1["name"];?></td>
				<td><?php echo $value1["position"];?></td>
				<?php if( $user['level_name']=='officer' ){ ?>
				<td>
					<a href = "staff-edit.php?id=<?php echo $value1["id"];?>&page=<?php echo $id;?>" alt = "แก้ไข" title = "แก้ไข"><img src="http://localhost/kpi/html/images/icon/edit.png"></a>
					<a href = "staff-delete.php?id=<?php echo $value1["id"];?>&page=<?php echo $id;?>" alt = "ลบ" title = "ลบ" class = "delete"><img src="http://localhost/kpi/html/images/icon/delete.png"></a>
				</td>
				<?php } ?>
			</tr>
			<?php } ?>
		</table>

		<?php }else{ ?>

		<form action = "sar-update.php" method = "post">
			<input type = "hidden" name = "id" value = "<?php echo $id;?>">
			<div class = "content">
				<?php if( $user['level_name']=='officer' ){ ?>
					<textarea class = "mce" name = "detail" style = "width:500px; height:200px;"><?php echo $page["$id"]['detail'];?></textarea>
					<br>
					<input type = "submit" value = "ปรับปรุงข้อมูล">
				<?php }else{ ?>
					<?php echo $page["$id"]['detail'];?>
				<?php } ?>
			</div>
		</form>
		<?php } ?>
		
	</div>
	<div class = "clear"></div>
</div>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("footer") . ( substr("footer",-1,1) != "/" ? "/" : "" ) . basename("footer") );?>